﻿// Decompiled with JetBrains decompiler
// Type: <>z__ReadOnlySingleElementList`1
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

#nullable disable
internal sealed class \u003C\u003Ez__ReadOnlySingleElementList<T> : 
  IEnumerable,
  ICollection,
  IList,
  IEnumerable<T>,
  IReadOnlyCollection<T>,
  IReadOnlyList<T>,
  ICollection<T>,
  IList<T>
{
  public \u003C\u003Ez__ReadOnlySingleElementList(T item) => this._item = item;

  IEnumerator IEnumerable.GetEnumerator()
  {
    // ISSUE: reference to a compiler-generated field
    return (IEnumerator) new \u003C\u003Ez__ReadOnlySingleElementList<T>.Enumerator(this._item);
  }

  int ICollection.Count => 1;

  bool ICollection.IsSynchronized => false;

  object ICollection.SyncRoot => (object) this;

  void ICollection.CopyTo(Array array, int index) => array.SetValue((object) this._item, index);

  [IndexerName("System.Collections.IList.this[]")]
  object IList.this[int index]
  {
    get
    {
      if (index != 0)
        throw new IndexOutOfRangeException();
      return (object) this._item;
    }
    set => throw new NotSupportedException();
  }

  bool IList.IsFixedSize => true;

  bool IList.IsReadOnly => true;

  int IList.Add(object value) => throw new NotSupportedException();

  void IList.Clear() => throw new NotSupportedException();

  bool IList.Contains(object value) => EqualityComparer<T>.Default.Equals(this._item, (T) value);

  int IList.IndexOf(object value)
  {
    // ISSUE: reference to a compiler-generated field
    return !EqualityComparer<T>.Default.Equals(this._item, (T) value) ? -1 : 0;
  }

  void IList.Insert(int index, object value) => throw new NotSupportedException();

  void IList.Remove(object value) => throw new NotSupportedException();

  void IList.RemoveAt(int index) => throw new NotSupportedException();

  IEnumerator<T> IEnumerable<T>.GetEnumerator()
  {
    // ISSUE: reference to a compiler-generated field
    return (IEnumerator<T>) new \u003C\u003Ez__ReadOnlySingleElementList<T>.Enumerator(this._item);
  }

  int IReadOnlyCollection<T>.Count => 1;

  [IndexerName("System.Collections.Generic.IReadOnlyList<T>.this[]")]
  T IReadOnlyList<T>.this[int index]
  {
    get
    {
      if (index != 0)
        throw new IndexOutOfRangeException();
      return this._item;
    }
  }

  int ICollection<T>.Count => 1;

  bool ICollection<T>.IsReadOnly => true;

  void ICollection<T>.Add(T item) => throw new NotSupportedException();

  void ICollection<T>.Clear() => throw new NotSupportedException();

  bool ICollection<T>.Contains(T item) => EqualityComparer<T>.Default.Equals(this._item, item);

  void ICollection<T>.CopyTo(T[] array, int arrayIndex) => array[arrayIndex] = this._item;

  bool ICollection<T>.Remove(T item) => throw new NotSupportedException();

  [IndexerName("System.Collections.Generic.IList<T>.this[]")]
  T IList<T>.this[int index]
  {
    get
    {
      if (index != 0)
        throw new IndexOutOfRangeException();
      return this._item;
    }
    set => throw new NotSupportedException();
  }

  int IList<T>.IndexOf(T item) => !EqualityComparer<T>.Default.Equals(this._item, item) ? -1 : 0;

  void IList<T>.Insert(int index, T item) => throw new NotSupportedException();

  void IList<T>.RemoveAt(int index) => throw new NotSupportedException();

  private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
  {
    public Enumerator(T item)
    {
      this.System\u002ECollections\u002EGeneric\u002EIEnumerator\u003CT\u003E\u002ECurrent = item;
    }

    object IEnumerator.Current => (object) this._item;

    T IEnumerator<T>.Current { get; }

    bool IEnumerator.MoveNext() => !this._moveNextCalled && (this._moveNextCalled = true);

    void IEnumerator.Reset() => this._moveNextCalled = false;

    void IDisposable.Dispose()
    {
    }
  }
}
